﻿//// See https://aka.ms/new-console-template for more information
using DK.BinarySearch;
using PointerBinarySearch;

Console.WriteLine("Binary Search:");
//var lenght = 10;
//var intArray = new int[lenght];
//for (int i = 0; i < lenght; i++)
//{
//    intArray[i] = new Random().Next(0, lenght * 10);
//}
//intArray = intArray.OrderBy(item => item).ToArray();
//var se = new Sequence(intArray);
//var findNumber = intArray[3];

System.Diagnostics.Stopwatch sw1 = new System.Diagnostics.Stopwatch();
System.Diagnostics.Stopwatch sw2 = new System.Diagnostics.Stopwatch();
System.Diagnostics.Stopwatch sw3 = new System.Diagnostics.Stopwatch();

var array = new int[] { 1, 3, 4, 5, 7, 8, 9, 11, 13, 15, 18, 19, 22, 23, 25, 27, 29, 34, 44, 51 };

sw3.Start();
QuickArray qArray = new QuickArray();
//qArray.FindIndex(34, 1, 3, 4, 5, 7, 8, 9, 11, 13, 15, 18, 19, 22, 23, 25, 27, 29, 34, 44, 51);
qArray.FindIndex(34, array);
sw3.Stop();
TimeSpan ts3 = sw3.Elapsed;
Console.WriteLine(ts3.TotalMilliseconds);//0.1425

sw1.Start();
var se = new Sequence(array);
se.FindIndex(34);
sw1.Stop();
TimeSpan ts1 = sw1.Elapsed;
Console.WriteLine(ts1.TotalMilliseconds);//0.1977

sw2.Start();
var intArray = new List<int>(array);
intArray.First(item => item == 34);
sw2.Stop();
TimeSpan ts2 = sw2.Elapsed;
Console.WriteLine(ts2.TotalMilliseconds);//0.5328




